<extend name="Layout/ins_page" />
<block name="content">
	<style>
		.sub_left_menu {
			height: 500px;
			overflow-y: scroll;
		}
	</style>
	{:W('PageHeader/simple',array('name'=>$row_info['name'].':所属成员','search'=>'S'))}
	<div class="operate panel panel-default">
		<div class="panel-body">
			<div class="pull-left">
				<a onclick="go_group()" class="btn btn-sm btn-primary">返回</a>
			</div>
			<div class="pull-right">
				<a onclick="add()" class="btn btn-sm btn-primary">添加成员</a>
				<a onclick="del()" class="btn btn-sm btn-danger">删除</a>
			</div>
		</div>
	</div>
	<!-- 列表显示区域  -->
	<div class="row">
		<form id="form_data" name="form_data" method="post" >
			<input type="hidden" name="group_id" id="group_id" value="{$row_info.id}">
			<div class="col-sm-12 sub_left_menu">
				<table class="table table-bordered">
					<thead>
						<tr>
							<th class="text-center col-4"><label class="inline pull-left">
								<input class="ace" type="checkbox" name="id-toggle-all" id="id-toggle-all" />
								<span class="lbl"></span></label></th>
							<th>
							<nobr>
								员工编号
							</nobr></th>
							<th>
							<nobr>
								姓名
							</nobr></th>
							<th>
							<nobr>
								部门
							</nobr></th>
							<th class="hidden">
							<nobr>
								职级
							</nobr></th>
							<th>
							<nobr>
								职位
							</nobr></th>
							<th>
							<nobr>
								状态
							</nobr></th>
						</tr>
					</thead>
					<tbody class="tbody">
						<volist name="user_list" id="data">
							<tr id="{$data.id}">
								<td class="text-center col-3"><label class="inline pull-left">
									<input class="ace" type="checkbox" name="user_id[]" value="{$data.id}" />
									<span class="lbl"></span></label></td>
								<td>
								<nobr>
									{$data.emp_no}
								</nobr></td>
								<td>
								<nobr>
									{$data.name}
								</nobr></td>
								<td>
								<nobr>
									{$data.dept_name}
								</nobr></td>
								<td class="hidden">
								<nobr>
									{$data.rank_name}
								</nobr></td>
								<td>
								<nobr>
									{$data.position_name}
								</nobr></td>
								<td>
								<nobr>
									{$data.is_del|status}
								</nobr></td>
							</tr>
						</volist>
					</tbody>
				</table>
			</div>
		</form>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		function go_group(){
			window.open('{:U("index")}',"_self");
		}
		
		function add() {
			winopen("{:U('add_user',array('group_id'=>$row_info['id']))}", 560, 470);
		};

		function btn_search() {
			sendForm("form_search", "__SELF__");
			$("#form_search").submit();
		}

		function key_search() {
			if (event.keyCode == 13) {
				sendForm("form_search", "__SELF__");
				return false;
			}
		}

		function del() {
			if ($("input:checked[name='user_id[]']").length < 1) {
				ui_error("请选择用户");
				return false;
			};
			sendForm("form_data", "{:U('del_user')}","__SELF__");
		}

		function showdata(result) {
			$("input[name='role_list[]']").each(function() {
				$(this).prop('checked', false);
			});
			for (var s in result.data) {
				$("#role_" + result.data[s].role_id).prop('checked', true);
			}
		}
	</script>

</block>